package testtiles.object;

import static testtiles.object.Messages.RECEIVED_DAMAGE;


public abstract class Weapon {

	private int range;
	private int damage;
	private float perform;
	private float cooldown;
	private UIWorld world;

	public Weapon() {
		
	}
	
	public Weapon(int range, int damage) {
		this.range = range;
		this.damage = damage;
	}

	public int getRange() {
		return range;
	}

	public void setRange(int range) {
		this.range = range;
	}

	public int getDamage() {
		return damage;
	}

	public void setDamage(int damage) {
		this.damage = damage;
	}

	public UIWorld getWorld() {
		return world;
	}

	public void setWorld(UIWorld world) {
		this.world = world;
	}

	public float getCooldown() {
		return cooldown;
	}

	public void setCooldown(float cooldown) {
		this.cooldown = cooldown;
	}

	public float getPerform() {
		return perform;
	}

	public void setPerform(float perform) {
		this.perform = perform;
	}

	public abstract void hit(Unit attacker, Unit enemy);
	
	protected void damage(Unit attacker, Unit enemy) {
		world.getMessenger().dispatch(RECEIVED_DAMAGE, attacker, enemy, 0f, damage);
	}
	
}
